<script setup lang="ts">
  import { useMemberStore } from '@/stores'
  import { onLaunch, onShow, onHide, onLoad } from '@dcloudio/uni-app'
  import { useRouter, onBeforeRouteUpdate } from 'vue-router'
  import { ref } from 'vue'

  const router = useRouter()
  const memberStore = useMemberStore()
  const user = memberStore.getUserInfo()

  onLaunch(() => {
    console.log('App Launch')
  })

  onShow(async () => {
    // await memberStore.setUserInfoAction()
    // console.log('App Show', memberStore.getUserInfo())

    // // 监听路由变化
    // onBeforeRouteUpdate((to, from) => {
    //   console.log('路由发生变化:', to)
    //   if (!user?.ticketTokenid && to?.path !== '/pages/login/login') {
    //     uni.showToast({ icon: 'error', title: '请重新登录' })
    //     uni.reLaunch({ url: '/pages/login/login' })
    //     return
    //   }
    // })
  })

  onHide(() => {
    console.log('App Hide')
  })
</script>

<style lang="scss">
  // 字体图标
  @import '@/styles/fonts.scss';
  @import '@/styles/base.scss';
  @import 'nutui-uniapp/styles/variables.scss';
</style>
